import { DataSetProps } from 'choerodon-ui/pro/lib/data-set/DataSet';
import { FieldType } from 'choerodon-ui/pro/lib/data-set/enum';

const getTableDsProps = (): DataSetProps => ({
  primaryKey: 'userid',
  autoQuery: false,
  pageSize: 5,
  queryFields: [
    { name: 'userid', type: FieldType.string, label: '编号' },
    { name: 'name', type: FieldType.string, label: '姓名' },
  ],
  fields: [
    {
      name: 'userid',
      type: FieldType.string,
      label: '编号',
      required: true,
    },
    {
      name: 'name',
      type: FieldType.intl,
      label: '姓名',
    },
    {
      name: 'age',
      type: FieldType.number,
      label: '年龄',
      max: 100,
      step: 1,
    },
    {
      name: 'sex',
      type: FieldType.string,
      label: '性别',
      lookupCode: 'HR.EMPLOYEE_GENDER',
      required: true,
    },
    { name: 'enable', type: FieldType.boolean, label: '是否开启' },
  ],
  data: [
    {userid: 1, name: '张三', age: 18, sex: '男' },
    {userid: 2, name: '李四', age: 18, sex: '男' },
    {userid: 3, name: '王五', age: 18, sex: '男' },
  ],
  events: {
    submit: ({ data }: any) => console.log('submit data', data),
  },
});

export default getTableDsProps;